<?php

class Soul_Db_Sql_Delete extends Soul_Db_Sql_Where{

	private $_table = '';

	public function delete($table){
		$this->_table = $table;
        return $this;
	}

	public function reset(){
		$this->_table ='';
        $this->resetWhere();
		$this->resetParameter();
        return $this;
	}	

	public function toSql(){
		$result = 'DELETE FROM `'.$this->_table.'`';
		$result .= parent::toSql();
		return $result;
	}

	public function execute($driver = NULL){
		$sql = $this->toSql();
        $driver = is_object($driver) ? $driver : Soul_Db_Factory::getDriver($driver);
		return $driver->setSql($sql, $this->getParameters())->execute();
	}
}